package com.dhl.composite;

import java.util.ArrayList;
import java.util.List;

/**
 * @title: College
 * @Author danghailiang
 * @Date: 2022/8/8 22:11
 * @Version 1.0
 */
public class College extends OrganizationComponent {

    List<OrganizationComponent> components = new ArrayList<>();

    public College(String name, String des) {
        super(name, des);
    }

    @Override
    public boolean add(OrganizationComponent component) {
        return components.add(component);
    }

    @Override
    public boolean remove(OrganizationComponent component) {
        return components.remove(component);
    }

    @Override
    public String getName() {
        return super.getName();
    }

    @Override
    public String getDes() {
        return super.getDes();
    }


    @Override
    public void print() {
        System.out.println("————————" + getName() + "————————");
        for (OrganizationComponent component : components) {
            component.print();
        }
    }
}
